/**
 * @TestArrayDic.as
 * 
 * @author sodaChen mail:asframe@qq.com
 * @version 1.0
 * <br>Copyright (C), 2010-2015 asFrame.com
 * <br>This program is protected by copyright laws.
 * <br>Program Name:ASFrame
 * <br>Date:2016-5-4
 */
package
{
	import com.asframe.time.TimeMoveut;
	
	import flash.display.Sprite;
	import flash.utils.Dictionary;
	
	/**
	 * test array and dic fast time
	 * @author sodaChen
	 * Date:2016-5-4
	 */
	public class TestArrayDic extends Sprite
	{
		public function TestArrayDic()
		{
			super();
			var ary:Array = [];
			var dic:Dictionary = new Dictionary();
			var i:int = 0;
			for (i = 0; i < 100000; i++) 
			{
				dic[i] = runCount;
				ary[i] = runCount;
			}
			TimeMoveut.startTime();
			for (i = 0; i < 100000; i++) 
			{
				ary[i]();
			}
			TimeMoveut.traceTimeMoveut("执行Array消耗时间：");
			count = 0;
			TimeMoveut.startTime();
			for (i = 0; i < 100000; i++) 
			{
				dic[i]();
			}
			TimeMoveut.traceTimeMoveut("执行Dic消耗时间：");
		}
		
		private var count:int;
		private function runCount():void
		{
			count++;
		}
	}
}